package com.dk.pojo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

//java中的对象想要读取配置文件的内容，我们的对象实体需要放到spring容器中
//如何讲实体放到spring容器中？ 1。注解方式@Componet（如以前的@Service@Controller） 2.配置文件的方式@Configuration
@Component//1.注解方式 在spring容器中
//此注解只给spring容器中的实体类赋值 屏蔽@Component此注解将不好使
@ConfigurationProperties(prefix = "user")//读取配置文件(application.yml)的内容
//value={"","",""}
@PropertySource(value = {"classpath:user.properties"})//springboot中加载不同文件 resources下的user.xx文件 只能用注解方式下面

public class User {
    //普通类型
    private Integer userId;
    private String userName;
    private Date birth;
    private Boolean flag;
    //引用数据类型
    private Map<String, Object> myMap;
    private List<Object> myList;
    //引用Dog对象
    private Dog dog;

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", birth=" + birth +
                ", flag=" + flag +
                ", myMap=" + myMap +
                ", myList=" + myList +
                ", dog=" + dog +
                '}';
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    public Map<String, Object> getMyMap() {
        return myMap;
    }

    public void setMyMap(Map<String, Object> myMap) {
        this.myMap = myMap;
    }

    public List<Object> getMyList() {
        return myList;
    }

    public void setMyList(List<Object> myList) {
        this.myList = myList;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }
}
